import request from '@/utils/request'

/**
 * 获取员工列表
 * @param {*} page 当前页码
 * @param {*} size 当前页容量
 * @returns
 */
export const getEmployeesListApi = (page, size) => {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

// 删除员工列表
export function delEmployeeApi(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

// 添加员工接口
export const addEmployeeApi = data => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

// 批量封装的接口
export const batchAddEmployeeApi = arr => {
  return request({
    url: 'sys/user/batch',
    method: 'post',
    data: arr
  })
}

// 保存员工的基本信息
export function saveUserDetailByIdApi(data) {
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}

/** *
 * 给员工分配角色
 * ***/
export function assignRolesApi(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
